﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Krist_em_up.Components;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Krist_em_up
{
    public class Background : Sprite
    {

        public Background(Kristemup agame, string decor, Vector2 position)
        {
            direction = new Vector2(0, 0);
            switch (decor)
            {
                case "sol":
                    textureAsset = "sol";
                    break;
                case "Paysage":
                    textureAsset = "Paysage";
                    break;
            }
            this.position = position;
            game = agame;
        }
        public new void Update()
        {

        }
        public void Drawsol(SpriteBatch spriteBatch,Vector2 origin)
        {
            int first = (int)origin.X % texture.Width;
            spriteBatch.Begin();

            float scale = (float)game.game.GraphicsDevice.Viewport.Height / (float)texture.Height;
            //Rectangle r = new Rectangle(first, 0, (int)(scale * texture.Width), (int)(scale * texture.Height));
            spriteBatch.Draw(texture, - new Vector2(first, 0) + position , null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
            spriteBatch.Draw(texture, - new Vector2(first, 0) + position + new Vector2(texture.Width, 0),  null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);            
            spriteBatch.End();
        }

    }
}
